<%@ page language="java"  pageEncoding="UTF-8"%>
<%@taglib uri="/WEB-INF/struts-tags.tld" prefix="s"%>
<!DOCTYPE html>
<html lang="zh">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>密码修改-沈阳外卖网</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- Bootstrap -->
<link href="publicui/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen" />
<!--[if lt IE 9]>
  <script src="public/js/html5shiv.js"></script>
<![endif]-->
<!-- application  -->
<link href="css/head.css" rel="stylesheet" />
<link href="css/foot.css" rel="stylesheet" />
<link href="css/favor_restaurant.css" rel="stylesheet" />
</head>

<body >

<!-----nav-->
<div class="head">
  <s:action name="top" executeResult="true"></s:action>
</div>
<!---/nav   --> 

<!---/body   -->
<div class="content" > 
<!--   content  -->
	         
<ul class="breadcrumb">
      <li><h1>修改密码</h1></li>
</ul>

<div class="wash-paper clearfix" id="profile">
  <s:include value="left.action?urlType=8"></s:include>
  <div class="main-content">
    <div class="content-header">
      <h2>修改密码</h2>
    </div>
    <div class="content-inner profile-changepwd">
      <form method="post" action="password.action" id="myform">
		<input type="hidden" name="action" value="update"/>
        <fieldset>
          <div class="control-group clear-fix">
            <label class="control-label" for=""><span class="required">*</span>原密码</label><span style="color:red" id="oldPwdMsg"></span>
            <div class="controls">
              <input name="oldPwd" id="oldPwd" maxlength="20" onblur="checkOldPwdAction();" type="password" />
              <p class="help-block">(请输入现在正在使用的密码)</p>
            </div><!--end input-->
          </div><!--end clearfix-->

          <div class="control-group">
            <label class="control-label" for=""><span class="required">*</span>新密码</label><span style="color:red" id="passwordMsg"></span>
            <div class="controls">
              <input name="password" id="password" maxlength="20" onKeyUp="passwordTest(this)" onblur="checkPasswordAction();" type="password"/ >
              <p class="help-block">（请输入新密码）</p>
            </div><!--end input-->
          </div><!--end clearfix-->

          <div class="control-group clear-fix">
            <label class="control-label" for=""><span class="required">*</span>重复新密码</label><span style="color:red" id="passfirmMsg"></span>
            <div class="controls">
              <input name="passfirm" id="passfirm" maxlength="20" onblur="checkPassfirmAction();" type="password">
              <p class="help-block">(请再输入一次新密码)</p>
            </div><!--end input-->
          </div><!--end clearfix-->

          <div class="form-actions">
            <button type="button" class="btn btn-warning" id="sf_guard_user_changepwd_submit" onclick="VF_regflag();">提交更改</button>
          </div>
        </fieldset>
      </form>
    </div>
  </div>
</div>
	
<!--   /content  -->
  <s:action name="foot" executeResult="true"></s:action>
</div>
<!--  alert div start---->
<div id="copy_dlg_restaurant"  class="restaurant-hover-dlg right hide" >
  <div class="wrapper dark_shadow">
    <div class="callout_tip"></div>
    <div class="detail"> </div>
  </div>
</div>
<!--  alert div  end ---->

<!---/body   --> 


<script src="publicui/js/jquery-1.8.3.js"></script> 
<script src="publicui/jquery-ui/js/jquery-ui-1.9.2.custom.js"></script> 
<script src="publicui/bootstrap/js/bootstrap.min.js"></script> 
<script src="js/head.js"></script> 
<script language="JavaScript" type="text/javascript">
<!--
function checkOldPwdAction(){
	if ($('#oldPwd').val() == "") {
    	$('#oldPwdMsg').html('请您填写原密码');
    	return false;
  	}
  	else if(!checkOldPwd()){
  		$('#oldPwdMsg').html('您的密码格式不正确');
    	return false;
  	}
	$('#oldPwdMsg').html('<img src="../images/check_right.gif" width="16" height="16">');
	return true;
}
function checkPasswordAction(){
	if ($('#password').val() == "") {
    	$('#passwordMsg').html('请您填写密码');
    	return false;
  	}
  	if(!checkPassword()){
  		$('#passwordMsg').html('请您按照正确格式填写密码');
    	return false;
  	}
  	$('#passwordMsg').html('<img src="../images/check_right.gif" width="16" height="16">');
  	return true;
}

function checkPassfirmAction(){
	if ($('#passfirm').val() == "") {
    	$('#passfirmMsg').html('请您填写确认密码');
    	return false;
  	}else{
  		if($('#password').val() != $('#passfirm').val()){
  			$('#passfirmMsg').html('确认密码与密码不相同');
  			return false;
  		}
  	}
  	$('#passfirmMsg').html('<img src="../images/check_right.gif" width="16" height="16">');
  	return true;
}
function VF_regflag(){
	var check_bl01=checkOldPwdAction();
	var check_bl02=checkPasswordAction();
	var check_bl03=checkPassfirmAction();
	if(check_bl01 && check_bl02 && check_bl03){
		$('#myform').submit();
	}
}
function checkOldPwd(){
	var password = $('#oldPwd').val();
	var regu =/^[a-zA-Z0-9_]{6,20}$/;
	var re = new RegExp(regu);
	if (re.test(password)) {
   		return true;
	}else{
   		return false;
	}	
}
function checkPassword(){
	var password = $('#password').val();
	var regu =/^[a-zA-Z0-9_]{6,20}$/;
	var re = new RegExp(regu);
	if (re.test(password)) {
   		return true;
	}else{
   		return false;
	}	
}
function passwordTest(obj) {
    var value = obj.val();  
    var result = getResult(value);  
    check(result);  
}  
              
function getResult(value) {  
    if(value.length < 3) {  
        return 0;  
    }  
    var i = 0;  
    if(value.match(/[a-z]/ig)) {  
        i++;  
    }  
    if(value.match(/[0-9]/ig)) {  
        i++;  
    }  
    if(value.match(/(.[^a-z0-9])/ig)) {  
        i++;  
    }  
    if(value.length < 6 && i > 0) {  
        i--  
    }  
    return i;  
}  
function check(num) {  
    if(num == 0) {  
        $("#passwordMsg").html("密码太短");  
    } else if (num == 1) {  
        $("#passwordMsg").html("密码强度差");  
    } else if (num == 2) {  
        $("#passwordMsg").html("密码强度良好");  
    } else if (num == 3) {  
        $("#passwordMsg").html("密码强度高");  
    } else {  
        $("#passwordMsg").html("未知错误");  
    }  
} 
-->
</script>
<s:if test="error!=null&&error!=''">
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="myModalLabel">提示</h3>
  </div>
  <div class="modal-body">
    <p><s:fielderror><s:param>error</s:param></s:fielderror></p>
  </div>
  <div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
   <!-- <button class="btn btn-primary">确定 </button>   -->
  </div>
</div>
<script type="text/javascript"  >
$('#myModal').modal();
</script>
</s:if>
</body> 
</html>

